!<template>
  <div id="app">
 <div class='meun'>
    <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
    <el-tab-pane label='世界地图' name="first" ></el-tab-pane>
    <el-tab-pane label="中国地图" name="second"></el-tab-pane>
    <el-tab-pane label="广东地图" name="third" ></el-tab-pane>
  </el-tabs>
  </div>
 <el-table
      :data="proviceData"
      style="width: 100%">
      <el-table-column
        prop="name"
        label="省份"
      >
      </el-table-column>
      <el-table-column
        prop="value"
        label="累计人数"
      >
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import axios from 'axios'
export default {
    data(){
        return {
            activeName: 'third',
             ChinaData:{},
             proviceData:[],
               chinaadd:'',
                add:'',
                dead:'',
                forgien:''
        }
    },
    created(){
      this.getData()
},

    methods:{
         handleClick(tab, event){
        if(tab.index==0){
           this.$router.push({path:'/world'})
          }
          if(tab.index==1){
            this.$router.push({path:'/china'})
          }
    },
     getData(){
           axios.get('getOnsInfo?name=disease_h5').then(response=>{
           var ret= response.data.data
          if(typeof ret === 'string'){
            var reg = /^\w+\(({[^()]+})\)$/
            var matches = ret.match(reg)  
            if(matches){             
              ret = JSON.parse(matches[1])
            }
          }
          
          this.ChinaData=JSON.parse(ret)
          console.log(this.ChinaData)

          this.getProvice(this.ChinaData.areaTree[0].children)
          console.log(this.proviceData)
    })
        
    },
       getProvice(data){
       for(var i=0;i<34;i++){
        // this.provice.total=''
        const provice={}
        provice.value=data[i].total.confirm
        provice.name=data[i].name
        this.proviceData[i]=provice
       }
    },
    }
}
</script>
<style scoped>
.meun{
    margin-top: -60px;
}
</style>